cmake_minimum_required(VERSION 3.14)

add_subdirectory(CMakeModules)

obtain_git_version(gitVersion ${CMAKE_CURRENT_SOURCE_DIR})
project(GtestConfig VERSION ${gitVersion}
        DESCRIPTION "wrap google test and omit unnecessary information"
        LANGUAGES CXX)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(AddGoogleTest)

if(APPLE)
    find_package(GTest REQUIRED)
else()
    set(GTEST_LIBRARY gtest pthread)
endif()

add_lib(TARGET GtestConfig
        VERSION ${gitVersion}
        SOURCE ConfigurableEventListener.cpp ConfigurableEventListener.h
        DEPENDENT ${GTEST_LIBRARY})

if(APPLE)
    target_include_directories(GtestConfig PUBLIC "/usr/local/include")
endif()
